<!DOCTYPE html>
<#assign ctx=request.contextPath/>
		<div class="container-fluid">
			<h2>用户角色配置</h2>
			<style>
				span.error {
		         	color:red;
		       	}
			</style>
			<div class="box box-primary">
				<div id="toolbar">
					<button id="" type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-edit" disabled="disabled">新增</button>
					<button id="deleteBtn" type="button" class="btn btn-primary">删除</button>
				</div>
				<div class="row">
					<table id="table" data-toggle="table" data-url="userole" data-striped="true" data-toolbar="#toolbar" data-pagination="true" data-search="true" data-page-size="10">
						<thead>
							<tr>
							    <th data-checkbox="true"></th>
								<th data-align="center" data-field="user_name" data-sortable="true">用户名</th>
								<th data-align="center" data-field="role_name" data-sortable="true">角色</th>
								<th data-align="center" data-formatter="operateFormatter" data-events="operateEvents">操作</th>
								
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div>
		<!-- 新增的弹窗 -->
		<div class="modal fade" id="modal-edit" aria-labelledby="modalEditLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<form class="form-horizontal" action="" method="post" id="addUserRoleForm">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
							<h4 class="modal-title" id="modalEditLabel">用户</h4>
						</div>
						<div class="modal-body">
							<div class="form-group">
								<label class="col-sm-3 control-label">用户名</label>
								<div class="col-sm-9">
									<select class="form-control" name="userId">
										<option value="" selected="selected">---请选择---</option>
										<#list list as list>
										<option value="${list.user_id}">${list.user_name}</option>
										</#list>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">角色</label>
								<div class="col-sm-9">
									<select class="form-control" name="roleId">
										<option value="" selected="selected">---请选择---</option>
										<#list role as role>
										<option value="${role.roleId}">${role.roleName}</option>
										</#list>
									</select>
								</div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button id="saveBtn" type="submit" class="btn btn-primary">保存</button>
						</div>
					</form>
				</div>
			</div>
		</div>
		
		<div class="modal fade" id="modal-edit2" aria-labelledby="modalEditLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<form class="form-horizontal" action="" method="post" id="updateUserRoleForm">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
							<h4 class="modal-title" id="modalEditLabel">用户</h4>
						</div>
						<input name="UserRoleId" type="hidden" class="form-control">
						<div class="modal-body">
							<div class="form-group">
								<label class="col-sm-3 control-label">用户名</label>
								<div class="col-sm-9">
									<select class="form-control" name="userId1" disabled="disabled">
										<option value="" selected="selected">---请选择---</option>
										<#list list1 as list1>
										<option value="${list1.user_id}">${list1.user_name}</option>
										</#list>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">角色</label>
								<div class="col-sm-9">
									<select class="form-control" name="roleId1">
										<option value="" selected="selected">---请选择---</option>
										<#list role as role>
										<option value="${role.roleId}">${role.roleName}</option>
										</#list>
									</select>
								</div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button id="saveBtn2" type="submit" class="btn btn-primary">保存</button>
						</div>
					</form>
				</div>
			</div>
		</div>
		<customScript>
		<script type="text/javascript">
			//格式化操作列
			function operateFormatter(value, row, index) {
				return [
					"<a class='edit' href='javascript:void(0)'>编辑</a>",
					"&nbsp;&nbsp;&nbsp;",
					"<a class='delete' href='javascript:void(0)'>删除</a>",
				].join('');
			}
		</script>
		<script type="text/javascript" src="${ctx}/views/admin/system/sysuserole.js"></script>
		</customScript>
		
